package Easy;
// 83.删除排序链表中的重复元素
public class Solution83 {
    class ListNode {
        int val;
        ListNode next;
        ListNode(int x) { val = x; }
    }
    public ListNode deleteDuplicates(ListNode head) {
        ListNode p =head;
        while (head!=null){
            try {
                if (head.next != null & head.val == head.next.val) {
                    head.next = head.next.next;
                }else
                    head = head.next;
            }catch (NullPointerException e){
                break;
            }
        }
        return p;
    }
}
